<template>
    <div>
       <ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media">
					<router-link to="/home/newsInfo/1">
						<img class="mui-media-object mui-pull-left" src="https://upload.jianshu.io/users/upload_avatars/10280144/f367231d-f05d-4d9f-a451-e1fdd0c6b521.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/80/h/80/format/webp">
						<div class="mui-media-body">
							<h1>幸福</h1> 
							<p class="mui-ellipsis">
                                <span>2020年7月22日15:28:40</span>
                                <span>点击 0 次</span>
                            </p>
						</div>
					</router-link>
				</li>
				<li class="mui-table-view-cell mui-media">
					<router-link to="/home/newsInfo/2">
						<img class="mui-media-object mui-pull-left" src="https://upload.jianshu.io/users/upload_avatars/10280144/f367231d-f05d-4d9f-a451-e1fdd0c6b521.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/80/h/80/format/webp">
						<div class="mui-media-body">
							<h1>幸福</h1> 
							<p class="mui-ellipsis">
                                <span>2020年7月22日15:28:40</span>
                                <span>点击 0 次</span>
                            </p>
						</div>
					</router-link>
				</li>
                <li class="mui-table-view-cell mui-media" v-for="item in newsList " :key='item.url'>
					<router-link :to="'/home/newsInfo'+item.id" class="">
						<img class="mui-media-object mui-pull-left" :src="item.url">
						<div class="mui-media-body">
							<h1>{{ item.title}}</h1> 
							<p class="mui-ellipsis">
                                <span>创建时间:{{item.add_time | dataFormat}}</span>
                                <span>点击 {{item.click}} 次</span>
                            </p>
						</div>
					</router-link>
				</li>

			</ul>
    </div>
</template>
<script>
import {Toast} from 'mint-ui'
export default {
    data(){
        return{
            newsList:[]
        }
    },
    created(){
        this.getNewsList();
    },
    methods:{
        getNewsList(){
            this.$http.get('api/getnewsList').then(result=>{
                if(result.body.status===0){
                  this.newList=result.body.message;  
                }else{
                    Toast('请求失败')
                }
            })
        }
    }
}
</script>
<style lang="scss" scoped>
.mui-media {
    h1 {
        font-size: 14px;
    }
    .mui-ellipsis {
        font-size: 12px;
        color: #226aff;
        display: flex;
        justify-content: space-between;
    }
}
</style>